var CommonTool = {};
CommonTool.getDim = function(el){
    for (var lx = 0, ly = 0; el != null; lx += el.offsetLeft, ly += el.offsetTop, el = el.offsetParent) 
        ;
    return {
        x: lx,
        y: ly
    }
}
 
/**
 * 弹出Div
 * 
 * @param {Object}
 *            str
 */
CommonTool.sAlert = function(inputObjStr, iLeft, iTop, iWidth, iHeight,
		strAction) {
	var msgw, msgh, bordercolor;
	msgw = iWidth;// 提示窗口的宽度
	msgh = iHeight;// 提示窗口的高度
	titleheight = 25 // 提示窗口标题高度
	bordercolor = "#336699";// 提示窗口的边框颜色
	titlecolor = "#99CCFF";// 提示窗口的标题颜色
	var msgObj = document.createElement("div")
	msgObj.setAttribute("id", "msgDiv");
	msgObj.setAttribute("align", "center");
	msgObj.style.background = "white";
	msgObj.style.border = "1px solid " + bordercolor;
	msgObj.style.position = "absolute";
	msgObj.style.filter = "progid:DXImageTransform.Microsoft.Shadow1(color=#999999,direction=135,strength=5";
	msgObj.style.left = iLeft;
	msgObj.style.top = iTop;
	msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
	msgObj.style.marginLeft = "-225px";
	msgObj.style.marginTop = -75 + document.documentElement.scrollTop + "px";
	msgObj.style.width = msgw + "px";
	msgObj.style.height = msgh + "px";
	msgObj.style.textAlign = "center";
	msgObj.style.lineHeight = "25px";
	msgObj.style.zIndex = "10001";

	var title = document.createElement("h4");
	title.setAttribute("id", "msgTitle");
	title.setAttribute("align", "right");
	title.style.margin = "0";
	title.style.padding = "3px";
	title.style.background = bordercolor;
	title.style.filter = "progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
	title.style.opacity = "0.75";
	title.style.border = "1px solid " + bordercolor;
	title.style.height = "18px";
	title.style.font = "12px Verdana, Geneva, Arial, Helvetica, sans-serif";
	title.style.color = "white";
	title.style.cursor = "pointer";
	title.innerHTML = "关闭";
	title.onclick = function() {

		document.getElementById("msgDiv").removeChild(title);
		document.body.removeChild(msgObj);
	}
	document.body.appendChild(msgObj);
	document.getElementById("msgDiv").appendChild(title);
	var txt = document.createElement("p");
	txt.style.margin = "1em 0"
	txt.setAttribute("id", "msgTxt");
	txt.innerHTML = "<input value=9999>";
	document.getElementById("msgDiv").appendChild(txt);
}

/**
 * 显示背景Div
 * 
 * @param {Object}
 *            o
 * @param {Object}
 *            s
 */
CommonTool.displayBackDiv = function() {

	var divObj = document.all.backDiv;
	var divText = document.all.backDivText;
	if (divObj)
		divObj.style.display = "inline";
	if (divText)
		divText.style.display = "inline";
}
CommonTool.displayBackDiv2 = function() {

	var divObj = document.all.backDiv2;
	// var divText = document.all.backDivText;
	if (divObj)
		divObj.style.display = "inline";
	// if (divText)
	// divText.style.display = "inline";
}
/**
 * 隐藏背景Div
 * 
 * @param {Object}
 *            o
 * @param {Object}
 *            s
 */
CommonTool.hiddenBackDiv = function() {

	var divObj = document.all.backDiv;
	var divText = document.all.backDivText;
	if (divObj)
		divObj.style.display = "none";
	if (divText)
		divText.style.display = "none";
}

/**
 * 隐藏背景Div2
 * 
 * @param {Object}
 *            o
 * @param {Object}
 *            s
 */
CommonTool.hiddenBackDiv2 = function() {

	var divObj = document.all.backDiv2;
	if (divObj)
		divObj.style.display = "none";
}

CommonTool.hiddenBackDiv2 = function() {

	var divObj = document.all.backDiv2;
	// var divText = document.all.backDivText;
	if (divObj)
		divObj.style.display = "none";
	
}
// wangyong add
CommonTool.displayBackDiv1 = function() {

	var divObj = document.all.backDiv1;
	var divText = document.all.backDivText1;
	if (divObj)
		divObj.style.display = "inline";
	if (divText)
		divText.style.display = "inline";
}

/**
 * 隐藏背景Div
 * 
 * @param {Object}
 *            o
 * @param {Object}
 *            s
 */
CommonTool.hiddenBackDiv1 = function() {

	var divObj = document.all.backDiv1;
	var divText = document.all.backDivText1;
	if (divObj)
		divObj.style.display = "none";
	if (divText)
		divText.style.display = "none";
}


CommonTool.noDrag = function(o) {
	if (typeof o == "string")
		o = document.getElementById(o);
	if (!o)
		return;
	o.onmousedown = null;
	o.onmousemove = null;
	o.onmouseup = null;
}
// ---------------------------------------
// 拖动控件的函数
// 参数：o 对象控件
// s
//
// ---------------------------------------
CommonTool.drag = function(o, s) {

	if (typeof o == "string")
		o = document.getElementById(o);
	if (!o)
		return;
 
	  
	o.orig_x = parseInt(o.style.left) - document.body.scrollLeft;
	 
	o.orig_y = parseInt(o.style.top) - document.body.scrollTop;
	o.orig_index = o.style.zIndex;

	o.onmousedown = function(a) {
		this.style.cursor = "hand";
		this.style.zIndex = 99999;
		var d = document;
		if (!a)
			a = window.event;
		var x = a.clientX + d.body.scrollLeft - o.offsetLeft;
		var y = a.clientY + d.body.scrollTop - o.offsetTop;
		// author: www.longbill.cn
		d.ondragstart = "return false;"
		d.onselectstart = "return false;"
		d.onselect = "document.selection.empty();"

		if (o.setCapture)
			o.setCapture();
		else if (window.captureEvents)
			window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);

		d.onmousemove = function(a) {
			if (!a)
				a = window.event;
			o.style.left = a.clientX + document.body.scrollLeft - x;
			o.style.top = a.clientY + document.body.scrollTop - y;
			o.orig_x = parseInt(o.style.left) - document.body.scrollLeft;
			o.orig_y = parseInt(o.style.top) - document.body.scrollTop;
		}

		d.onmouseup = function() {
			if (o.releaseCapture)
				o.releaseCapture();
			else if (window.captureEvents)
				window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
			d.onmousemove = null;
			d.onmouseup = null;
			d.ondragstart = null;
			d.onselectstart = null;
			d.onselect = null;
			o.style.cursor = "normal";
			//o.style.zIndex = o.orig_index;
			try{
			     doDragEnd();
			}
			catch(e)
			{
			}
		}
	}

// if (s) {
// var orig_scroll = window.onscroll ? window.onscroll : function() {
// };
// window.onscroll = function() {
//			 
// orig_scroll();
// o.style.left = o.orig_x + document.body.scrollLeft;
// o.style.top = o.orig_y + document.body.scrollTop;
// }
// }
}
/**
 * 替换页面ｉｎｐｕｔ的值
 * 
 * @param {Object}
 *            newTextElements
 */
CommonTool.replaceExistingWithNewHtml = function(newTextElements) {
	for ( var i = newTextElements.length - 1; i >= 0; --i) {
		if (newTextElements[i].indexOf(":") > -1) {
			startNamePos = newTextElements[i].indexOf("[") + 1;
			endNamePos = newTextElements[i].indexOf(":", startNamePos);
			name = newTextElements[i].substring(startNamePos, endNamePos);
			startContentPos = newTextElements[i].indexOf(":") + 1;
			content = newTextElements[i].substring(startContentPos);
			if (document.getElementById(name)) {
				if (document.getElementById(name).type == "text"
						|| document.getElementById(name).type == "hidden") {
					document.getElementById(name).value = content;
				} else {
					document.getElementById(name).innerHTML = content;
				}
			} else {
				continue;
			}
		}
	}
}

CommonTool.replacePageElementValueByPrefix = function(prefix,newTextElements) {
	// loop through newTextElements
	// alert(newTextElements);
	for ( var i = newTextElements.length - 1; i >= 0; --i) {
		// check that this begins with <span
		if (newTextElements[i].indexOf(":") > -1) {

			// get the name - between the 1st and 2nd quote mark
			startNamePos = newTextElements[i].indexOf("[") + 1;
			endNamePos = newTextElements[i].indexOf(":", startNamePos);
			name = prefix  + newTextElements[i].substring(startNamePos, endNamePos) ;

			// get the content - everything after the first > mark
			startContentPos = newTextElements[i].indexOf(":") + 1;
			content = newTextElements[i].substring(startContentPos);

			// Now update the existing Document with this element
			// check that this element exists in the document
			// alert(name+document.getElementById(name));
			if (document.getElementById(name)) {
				if (document.getElementById(name).type == "text"
						|| document.getElementById(name).type == "hidden") {
					document.getElementById(name).value = content;
				} else {
					document.getElementById(name).innerHTML = content;
				}
			} else {
				//alert(name);
				continue;
			}
		}
	}
}

/**
 * 创建图标
 */
CommonTool.getPageIconStringEx = function(imgWidth, imgHeight, iTextDistance,
		imgNum, imgPath, name, x, y, url, xNum, yNum,lineDistance,opacity,backX,backY) {
 
	var iconString = "<DIV id=a"
			+ imgNum
			+ " opacityFlag=1 onmouseout=\"switchLoseFocusImg(this)\""
			+ " onmouseover=\"switchFocusImg(this)\""
			+ " onclick=\""
			+ "window.location='"
			+ url
			+ "'\" align=center "
			+ " style='width: 150; z-index: 10; FILTER: alpha(opacity =" +opacity+ "); POSITION: absolute; left:"
			+ (x - -(imgWidth - -iImgDistance)*xNum)
			+ "px; top:"
			+ (y - -(imgHeight - -iTextDistance)*(yNum-1) - -lineDistance)
			+ "px;'>"
			+ " <input class=\"shadowButton\" type=button value=\"\" id=\"imgButton\""
			+ " style=\"background: 'url("
			+ imgPath
			+ ")  no-repeat';background-position:" +backX+ "px "+backY+"px; font-size: 16px; line-height: 30px; width:"
			+ imgWidth
			+ "px; height:"
			+ imgHeight
			+ "px\">"
			+ " </DIV>"
			+ " <DIV"
			+ " onmouseout=\"switchLoseFocusImg(document.all.a"
			+ imgNum
			+ ")\""
			+ " onmouseover=\"switchFocusImg(document.all.a"
			+ imgNum
			+ ")\""
			+ " onclick=\"window.location='"
			+ url
			+ "'\" id=\"objDiv\" align=center "
			+ " style=\"width: 150; z-index: 10; FILTER: alpha(opacity = 100); POSITION: absolute; left:"
			+ (x - -(imgWidth - -iImgDistance)*xNum)
			+ "px; top:"
			+ (y - -(imgHeight - -iTextDistance) * yNum - -lineDistance)
			+ "px;\">"
			+ " <span style=\"cursor:hand;font-size: 12px; font-weight: bold; color: 000000\">"
			+ name + "</span>" + " </DIV>";
	// alert(iconString)
	return iconString;
}

/**
 * 创建图标
 */
CommonTool.getPageIconString = function(imgWidth, imgHeight, iTextDistance,
		imgNum, imgPath, name, x, y, url, xNum, yNum,lineDistance,opacity) {
  	return  this.getPageIconStringEx(imgWidth, imgHeight, iTextDistance,
			imgNum, imgPath, name, x, y, url, xNum, yNum,lineDistance,opacity,0,0);
}


/**
 * 创建图标
 */
CommonTool.getPageIconString2 = function(imgWidth, imgHeight, iTextDistance,
		imgNum, imgPath, name, x, y, url, xNum, yNum,lineDistance,opacity,backX,backY) {
 
	var iconString = "<DIV id=a"
			+ imgNum
			+ " opacityFlag=1 onmouseout=\"switchLoseFocusImg(this)\""
			+ " onmouseover=\"switchFocusImg(this)\""
			+ " onclick=\""
 			+ url
			+ "\" align=center "
			+ " style='width: 150; z-index: 10; FILTER: alpha(opacity =" +opacity+ "); POSITION: absolute; left:"
			+ (x - -(imgWidth - -iImgDistance)*xNum)
			+ "px; top:"
			+ (y - -(imgHeight - -iTextDistance)*(yNum-1) - -lineDistance)
			+ "px;'>"
			+ " <input class=\"shadowButton\" type=button value=\"\" id=\"imgButton\""
			+ " style=\"background: 'url("
			+ imgPath
			+ ")  no-repeat';background-position:" +backX+ "px "+backY+"px; font-size: 16px; line-height: 30px; width:"
			+ imgWidth
			+ "px; height:"
			+ imgHeight
			+ "px\">"
			+ " </DIV>"
			+ " <DIV"
			+ " onmouseout=\"switchLoseFocusImg(document.all.a"
			+ imgNum
			+ ")\""
			+ " onmouseover=\"switchFocusImg(document.all.a"
			+ imgNum
			+ ")\""
			+ " onclick=\""
			+ url
			+ "\" id=\"objDiv\" align=center "
			+ " style=\"width: 150; z-index: 10; FILTER1: alpha(opacity = 100); POSITION: absolute; left:"
			+ (x - -(imgWidth - -iImgDistance)*xNum)
			+ "px; top:"
			+ (y - -(imgHeight - -iTextDistance) * yNum - -lineDistance)
			+ "px;\">"
			+ " <span style=\"cursor:hand;font-size: 18px; font-weight: bold; color: 000000\">"
			+ name + "</span>" + " </DIV>";
	// alert(iconString)
	return iconString;
}

//add
CommonTool.divMove=function(divName,ev){
	var mouseStatus=false;
	var jx;
	var jy;
	var divName=divName;
	mousePosition=function(ev){ 
		 if(ev.pageX || ev.pageY){ 
		  return {x:ev.pageX, y:ev.pageY}; 
		  } 
		  return { 
		   x:ev.clientX + document.body.scrollLeft - document.body.clientLeft, 
		   y:ev.clientY + document.body.scrollTop  - document.body.clientTop 
		  }; 
	} 
	 	ev = ev || window.event; 
		var mousePos = mousePosition(ev); 
		mouseStatus=true;
		jx=mousePos.x-document.getElementById(divName).offsetLeft;
		jy=mousePos.y-document.getElementById(divName).offsetTop;
		document.getElementById(divName).style.cursor="move";
	document.onmousemove =function(ev){ 
		ev = ev || window.event; 
		var mousePos = mousePosition(ev); 
		if(mouseStatus){
			document.getElementById(divName).style.top=mousePos.y-jy ;
			document.getElementById(divName).style.left= mousePos.x-jx;
			}
	} 

	document.onmouseup=function(){
		document.getElementById(divName).style.cursor="";
		mouseStatus=false;
		jx=0;
		jy=0;
	}
	
}

CommonTool.GetDate=function(){
 var d,s;
 d = new Date();
 s = d.getYear() + "";             //取年份
 var month = ((d.getMonth() + 1)+"");
 if(month.length<2){
	 month = "0"+month;
 }
 s = s + month + "";//取月份
 s += d.getDate() + "";         //取日期

 return(s);  

} 


CommonTool.GetDateT=function(){
 var d,s;
 d = new Date();
 s = d.getYear() + "-";             //取年份
 s = s + (d.getMonth() + 1) + "-";//取月份
 s += d.getDate() + " ";         //取日期
 s += d.getHours() + ":";       //取小时
 s += d.getMinutes() + ":";    //取分
 var ss = d.getSeconds();
 if(ss<10) ss ="0" + ss;
 s += ss;         //取秒
 return(s);  

} 

CommonTool.getValue=function(dataObj2,paraName) {
	if(!dataObj2||!paraName)return "";
	var dataObj = dataObj2.split("]");
	for ( var i = 0; i < dataObj.length; i++) {
		// check that this begins with <span
		if (dataObj[i].indexOf(":") > -1) {
			// get the name - between the 1st and 2nd quote mark
				startNamePos = dataObj[i].indexOf("[") + 1;
			endNamePos = dataObj[i].indexOf(":", startNamePos);
			name = dataObj[i].substring(startNamePos, endNamePos);
		//	alert(name + "----" + paraName)
				if (paraName.toUpperCase() == name.toUpperCase()) {
				startContentPos = dataObj[i].indexOf(":") + 1;
				return dataObj[i].substring(startContentPos);
			}
		}
	}
	return "";
}

CommonTool.selectOrganCode=	function(contry,organType,tellContry){
	//公共机构列表(默认)
	var url=g_pathPrefix+"smOrgan.do?method=querySmOrganCommon";
	//与监控有关的机构
	if(organType=="200"){
		url=g_pathPrefix+"smOrgan.do?method=querySmOrganAssign";
	}else if(organType == "10000"){ //受理平台,added by yh.song 2011.5.15
		url=g_pathPrefix+"smOrgan.do?method=queryReviewSmOrgan";
	}
	var modelFrameUrl = g_pathPrefix+"commons/modelDialogFrame.jsp";
	var url = modelFrameUrl + "?title=" + encodeURI(encodeURI("机构列表信息")) + "&url="+url;
	var rValue=window.showModalDialog(url,"","dialogWidth=600px; dialogHeight=500px; help=no; status=no; scroll=yes; resizable=no;");
	if(!(rValue==""||rValue=="000000"||rValue==undefined)){
		contry.value=rValue;
		//alert(tellContry);
		if(null!=tellContry&&tellContry!=undefined){
			CommonTool.getTellerByOrgan(rValue,tellContry);
		}
	}
}

//验证分配机构合法性
CommonTool.validateAssignOrgan = function (organContry){
	var orgCode =organContry.value;
	if(orgCode.length<5){
		return true;
	}
	var url =g_pathPrefix+"smOrgan.do?method=validateAssignOrgan&orgCode=" + orgCode ; 
		try{
			var req = retrieveSynURL(url, "");
			if(req.status == 200) {
				var responseText = req.responseText;
				var flag = responseText.substring(0,1);
				if(flag==0){
					return true;
				}
				alert(responseText.substring(2));
				organContry.focus();
				organContry.value="";
				return false;
			}
			else{
				alert("Request Error: " + req.statusText);
			}
		}catch(e){
			alert("机构验证失败！");
		}
	
}

//选择监管辅助中的风险点
CommonTool.selectWtcheckPoint =	function(curObj,errorGrade,pointId){
	//公共机构列表(默认)
	var url=g_pathPrefix+"wtCheckPoint.do?method=selectWtCheckPointCommon";
	var modelFrameUrl = g_pathPrefix+"commons/modelDialogFrame.jsp";
	var url = modelFrameUrl + "?title=" + encodeURI(encodeURI("监管辅助风险点列表信息")) + "&url="+url;
	var rValue=window.showModalDialog(url,"","dialogWidth=600px; dialogHeight=600px; help=no; status=no; scroll=yes; resizable=no;");
	if(!(rValue==""||rValue==undefined)){
		var values = rValue.split("#");
		//alert("values="+values);
		var text=values[0];
		curObj.nodeValue=text;
		curObj.parentNode.title=text;
		errorGrade.value= values[1];
		pointId.value=values[2];
	}
}

CommonTool.organValidate=function(organContry){
		var orgCode =organContry.value;
		if(orgCode.length<5){
			return true;
		}
		/*
		if((orgCode.length<5||orgCode.length>4)&&orgCode!=0){
			alert("输入的机构位数不正确，请重新输入");
			organContry.focus();
			return false;
		}
		*/
		var url =g_pathPrefix+"smOrgan.do?method=validateSmOrgan&orgCode=" + orgCode ; 
			try{
				var req = retrieveSynURL(url, "");
				if(req.status == 200) {
					var responseText = req.responseText;
					var flag = responseText.substring(0,1);
					if(flag==0){
						return true;
					}
					alert(responseText.substring(2));
					return false;
				}
				else{
					alert("Request Error: " + req.statusText);
				}
			}catch(e){
				alert("机构验证失败！");
			}
}

CommonTool.organValidate_=function(organContry){
	var orgCode =organContry.value;
	/**/
	if(orgCode.length<5){
		alert("输入的机构位数不正确，请重新输入");
		organContry.focus();
		return false;
	}
	
	var url =g_pathPrefix+"smOrgan.do?method=validateSmOrgan&orgCode=" + orgCode ; 
		try{
			var req = retrieveSynURL(url, "");
			if(req.status == 200) {
				var responseText = req.responseText;
				var flag = responseText.substring(0,1);
				if(flag==0){
					return true;
				}
				alert(responseText.substring(2));
				return false;
			}
			else{
				alert("Request Error: " + req.statusText);
			}
		}catch(e){
			alert("机构验证失败！");
		}
}
//add for review by yh.song,2011.8.11
CommonTool.organValidateSimply = function(organContry){
	var orgCode = organContry.value;
	if(orgCode.length<5){
		alert("输入的机构位数不正确,请重新输入4位机构号!");
		organContry.focus();
		return false;
	}
	if(!/^\w*$/gi.test(orgCode)){
		alert("机构号只能为数字或字母,请重新输入!");
		organContry.focus();
		return false;
	}
	var url =g_pathPrefix+"smOrgan.do?method=validateOrganSimply&orgCode=" + orgCode ; 
	try{
		var req = retrieveSynURL(url, "");
		if(req.status == 200) {
			var responseText = req.responseText;
			var flag = responseText.substring(0,1);
			if(flag==0){
				return true;
			}
			alert(responseText.substring(2));
			organContry.focus();
			return false;
		}
		else{
			alert("Request Error: " + req.statusText);
		}
	}catch(e){
		alert("机构验证失败！");
	}
	return false;
}

//验证用户录入用户是否合法
CommonTool.smUserValidate = function(smUserContry){
	var userId = smUserContry.value;
	if(userId!=""){
		var url = g_pathPrefix+"barterModelList.do?method=validateSmUser&userId="+userId;
		var req = retrieveSynURL(url, "");
		try {
			if (req.status == 200) {
				var responseText = req.responseText;
				var flag = responseText.substring(0,1);
				if(flag==0){
					return true;
				}
				alert(responseText.substring(2));
				smUserContry.focus();
				return false;
			}
		} catch (e) {
			alert(" 出错！");
		}
	}
	return true;
}



//限制输入机构等级必须为指定等级
CommonTool.checkOrganByLevel = function (orgCode,checkedLevel){
	if(orgCode !="" && orgCode.length!=5){
		alert("输入的机构位数不正确，请重新输入");
		return false
	}
	//alert("checkedLevel="+checkedLevel);
	//暂时将机构层级查询放宽一级
	checkedLevel = checkedLevel - 1;
	var url = g_pathPrefix+"smOrgan.do?method=getSmorganLevel&orgCode="+ orgCode+"&checkedLevel="+checkedLevel;
	//  alert(url);
		var req = retrieveSynURL(url, "");
		try {
			if (req.status == 200) {
				var responseText = req.responseText;
				var flag = responseText.substring(0,1);
				if(flag==0){
					return true;
				}
				alert(responseText.substring(2));
				return false;
			}
		} catch (e) {
			alert(" 出错！");
		}
}

//限制输入机构等级必须为指定等级
CommonTool.validOrganByLevel = function (orgCode,checkedLevel){
	if(orgCode !="" && orgCode.length!=5){
		alert("机构号不正确");
		return false
	}
	//alert("checkedLevel="+checkedLevel);
	//暂时将机构层级查询放宽一级
	checkedLevel = checkedLevel;
	var url = g_pathPrefix+"smOrgan.do?method=validSmorganLevel&orgCode="+ orgCode+"&checkedLevel="+checkedLevel;
	//  alert(url);
		var req = retrieveSynURL(url, "");
		try {
			if (req.status == 200) {
				var responseText = req.responseText;
				var flag = responseText.substring(0,1);
				if(flag==0){
					return true;
				}
				if(flag==1){
					alert(responseText.substring(2));
					return false;
				}
				return false;
			}
		} catch (e) {
			alert(" 出错！");
		}
}

CommonTool.getTellerByOrgan=function (orgCode,tellContry){
	/*
	 if(orgCode.length!=4){
		tellContry.options.length=0;
		tellContry.options.add(new Option("--请选择--",""));
		alert("输入的机构位数不正确，请重新输入");
	}
	*/
	if(orgCode.length == 5){
		  var url = g_pathPrefix+"bmsPaperCrend.do?method=changeOrgPublic01&orgCode="+ orgCode;
		//  alert(url);
			var req = retrieveSynURL(url, "");
			try {
				if (req.status == 200) {
					var responseText = req.responseText;
					if(tellContry != null){
						tellContry.options.length=0;
						tellContry.options.add(new Option("--请选择--",""));
						if(responseText == ""){
							alert("机构号为："+orgCode+"的机构下没有柜员！");
							return;
						}
						if(responseText == "error"){
							alert("机构号为："+orgCode+"的机构信息不合法！");
							return;
						}
						
						if(responseText == "error1"){
							alert("虚拟机构下没有柜员信息");
							return;
						}
						if(responseText == "null"){
							//alert("虚拟机构下没有柜员信息");
							return;
						}
						var cols = responseText.split("@");
						for ( var i = 0; i < cols.length - 1; i++) {
							var k=cols[i].split('|');
							 var st="";
							 if(k[2]=='1'){
								 st="冻结柜员"
							 }
							tellContry.options.add(new Option(k[0]+"-"+k[1]+"-"+st,k[0]));
						}
					}
				}
			} catch (e) {
				alert(" 出错！");
			}
		}
}
CommonTool.getTellerByOrgan01=function (orgCode,tellContry){
	/*
	 if(orgCode.length!=4){
		tellContry.options.length=0;
		tellContry.options.add(new Option("--请选择--",""));
		alert("输入的机构位数不正确，请重新输入");
	}
	*/
	
	if(orgCode.length == 5){
	  var url = g_pathPrefix+"bmsPaperCrend.do?method=changeOrgPublic01&orgCode="+ orgCode;
	//  alert(url);
		var req = retrieveSynURL(url, "");
		try {
			if (req.status == 200) {
				var responseText = req.responseText;
				if(tellContry != null){
					tellContry.options.length=0;
					tellContry.options.add(new Option("--请选择--",""));
					if(responseText == ""){
						alert("机构号为："+orgCode+"的机构下没有柜员！");
						return;
					}
					if(responseText == "error"){
						alert("机构号为："+orgCode+"的机构信息不合法！");
						return;
					}
					
					if(responseText == "error1"){
						alert("虚拟机构下没有柜员信息");
						return;
					}
					var cols = responseText.split("@");
					for ( var i = 0; i < cols.length - 1; i++) {
						var k=cols[i].split('|');
						 var st="";
						 if(k[2]=='1'){
							 st="冻结柜员"
						 }
						tellContry.options.add(new Option(k[0]+"-"+k[1]+"-"+st,k[0]));
					}
				}
			}
		} catch (e) {
			alert(" 出错！");
		}
	}
}
CommonTool.getTellerByOrganSimply=function (orgCode,tellContry){
	/*
	 if(orgCode.length!=4){
		tellContry.options.length=0;
		tellContry.options.add(new Option("--请选择--",""));
		alert("输入的机构位数不正确，请重新输入");
	}
	*/
	
	if(orgCode.length == 5){
	  var url = g_pathPrefix+"bmsPaperCrend.do?method=findOrgTeller&orgCode="+ orgCode;
	//  alert(url);
		var req = retrieveSynURL(url, "");
		try {
			if (req.status == 200) {
				var responseText = req.responseText;
				tellContry.options.length=0;
				tellContry.options.add(new Option("--请选择--",""));
				if(responseText == ""){
					alert("机构号为："+orgCode+"的机构下没有柜员！");
					return;
				}
				if(responseText == "error"){
					alert("机构号为："+orgCode+"的机构信息不合法！");
					return;
				}
				
				if(responseText == "error1"){
					alert("虚拟机构下没有柜员信息");
					return;
				}
				var cols = responseText.split("@");
				for ( var i = 0; i < cols.length - 1; i++) {
					var k=cols[i].split('|');
					tellContry.options.add(new Option(k[0]+"-"+k[1],k[0]));
				}
			}
		} catch (e) {
			alert(" 出错！");
		}
	}
}

CommonTool.getMultiTellerByOrgan=function (orgCode,tellContry){
	if(orgCode.length == 5){
		  var url = g_pathPrefix+"bmsPaperCrend.do?method=changeOrgPublic&orgCode="+ orgCode;
		  var req = retrieveSynURL(url, "");
		  try {
			  if (req.status == 200) {
				  var responseText = req.responseText;
				  if(responseText == ""){
					  alert("机构号为："+orgCode+"的机构下没有柜员！");
					  return;
				  }
				  if(responseText == "error"){
					  alert("机构号为："+orgCode+"的机构信息不合法！");
					  return;
				  }
				  if(responseText == "error1"){
					  alert("虚拟机构下没有柜员信息");
					  return;
				  }
				  var cols = responseText.split("@");
				  tellContry.multiSelect.clearItems();
				  for ( var i = 0; i < cols.length - 1; i++) {
					  var k=cols[i].split('|');
					  tellContry.multiSelect.addItem(k[0]+"-"+k[1],k[0]);
				  }
			  }
		  }catch (e) {
			  alert(" 出错！");
		  }
	}
}

CommonTool.getSmUsersByOrgCode=function (orgCode,tellContry){
	if(orgCode.length!=5){
		tellContry.options.length=0;
		tellContry.options.add(new Option("--请选择--",""));
		alert("输入的机构位数不正确，请重新输入");
	}
	
	if(orgCode.length == 5){
	  var url = g_pathPrefix+"smOrgan.do?method=getSmUsersByOrg&orgCode="+ orgCode;
	//  alert(url);
		var req = retrieveSynURL(url, "");
		try {
			if (req.status == 200) {
				var responseText = req.responseText;
				tellContry.options.length=0;
				tellContry.options.add(new Option("--请选择--",""));
				if(responseText == ""){
					alert("机构号为："+orgCode+"的机构下没有操作员！");
					return;
				}
				if(responseText == "error"){
					alert("机构号为："+orgCode+"的机构信息不合法！");
					return;
				}
				
				if(responseText == "error1"){
					alert("虚拟机构下没有操作员信息");
					return;
				}
				var cols = responseText.split("@");
				for ( var i = 0; i < cols.length - 1; i++) {
					var k=cols[i].split('|');
					tellContry.options.add(new Option(k[0]+"-"+k[1],k[0]));
				}
			}
		} catch (e) {
			alert(" 出错！");
		}
	}
}

CommonTool.getbetweenTime=function (beginDate,endDate){
	   var d, s, t;
	   var MinMilli = 1000 * 60;
	   var HrMilli = MinMilli * 60;
	   var DyMilli = HrMilli * 24;
	   d = new Date(beginDate.substr(0,4),beginDate.substr(4,2),beginDate.substr(6,2));
	   d2=new Date(endDate.substr(0,4),endDate.substr(4,2),endDate.substr(6,2));
	   t = d2.getTime()-d.getTime();
	   s =t / DyMilli;
	   if(s>30){
		   alert( "日期间隔不能大于30天！");
	 	  return false;
	   }
	   return true;
}
//
CommonTool.getbetweenTimeDay=function (beginDate,endDate,dayNum){
	   var d, s, t;
	   var MinMilli = 1000 * 60;
	   var HrMilli = MinMilli * 60;
	   var DyMilli = HrMilli * 24;
	   if(dayNum==null || dayNum==""){
		   dayNum = 15;
	   }
	   d = new Date(beginDate.substr(0,4),beginDate.substr(4,2),beginDate.substr(6,2));
	   d2=new Date(endDate.substr(0,4),endDate.substr(4,2),endDate.substr(6,2));
	   t = d2.getTime()-d.getTime();
	   s =t / DyMilli;
	   if(s>dayNum){
		   alert( "日期间隔不能大于"+dayNum+"天！");
	 	  return false;
	   }
	   return true;
}
CommonTool.getbetweenDay=function (beginDate,endDate,days){
	   var d, s, t;
	   var MinMilli = 1000 * 60;
	   var HrMilli = MinMilli * 60;
	   var DyMilli = HrMilli * 24;
	   d = new Date(beginDate.substr(0,4),beginDate.substr(4,2),beginDate.substr(6,2));
	   d2=new Date(endDate.substr(0,4),endDate.substr(4,2),endDate.substr(6,2));
	   t = d2.getTime()-d.getTime();
	   s =t / DyMilli;
	   if(s>days){
		   alert( "日期间隔不能大于"+days+"天！");
	 	  return false;
	   }
	   return true;
}
//限制查询时间间隔
CommonTool.getLimitDay=function (beginDate,endDate,days){
 
	   var d, s, t;
	   var MinMilli = 1000 * 60;
	   var HrMilli = MinMilli * 60;
	   var DyMilli = HrMilli * 24;
	   if(beginDate.length == 10)beginDate = beginDate.replace("-","").replace("-","");
	   if(endDate.length == 10)endDate = endDate.replace("-","").replace("-","");
	   d = new Date(beginDate.substr(0,4),beginDate.substr(4,2),beginDate.substr(6,2));
	   d2=new Date(endDate.substr(0,4),endDate.substr(4,2),endDate.substr(6,2));
	   t = d2.getTime()-d.getTime();
	   //alert(days)
	   s =t / DyMilli;
	   if(s>days){
		  if(s > 365){
			  alert( "操作日期不能跨年查询！");
		  }else if(s > 30){
			  alert( "操作日期不能跨月查询！");
		  }else{
			  alert( "操作日期间隔不能大于"+days+"天！");
		  }
	 	  return false;
	   }
	   return true;
}
//验证起止日期为同一年，不能跨年查询
CommonTool.checkDateInSameYear=function (beginDate,endDateObj){
		var endDate = endDateObj.value;
		//alert(endDate);
	   if(endDate==null ||endDate==""){
		   return true;
	   }
	   var s1 = beginDate.substr(0,4);
	   var s2 = endDate.substr(0,4);
	   //alert(s1+"---"+s2);
	   if(s1!="" && s1!=s2){
		   alert(" 不能跨年查询");
		  endDateObj.value="";  
		  endDateObj.focus();
	 	  return false;
	   }
	   return true;
}
//验证起止日期为同一月，不能跨月修改
CommonTool.checkDateInSameMonth=function (trDate,newDateObj){
		var newDate = newDateObj.value;
		//alert(newDate);
	   if(newDate==null ||newDate==""){
		   return true;
	   }
	   var s1 = trDate.substr(0,6);
	   var s2 = newDate.substr(0,6);
	   //alert(s1+"---"+s2);
	   if(s1!="" && s1!=s2){
		   alert(" 不允许跨月修改");
		   newDateObj.value="";  
		   newDateObj.focus();
	 	  return false;
	   }
	   return true;
}
//验证起止日期为同一月，不能跨月处理
CommonTool.checkDatesInSameMonth=function (trDate,newDateObj,message){
		if(trDate == null || trDate.value == "" ){
			alert("交易日期不能为空！");
			trDate.focus();
			return false;
		}
		if(newDateObj == null || newDateObj.value == ""){
			alert("交易日期不能为空！");
			newDateObj.focus();
			return false;
		}
		var yymm1 = trDate.value.substr(0,6);
		var yymm2 = newDateObj.value.substr(0,6);
		if(yymm1 == "" || yymm2 == "" || yymm1 != yymm2){
			alert(message);
			newDateObj.focus();
			return false;
		}
		return true;
	}
/////////////////以下考核评价部分使用////////////////////////////

CommonTool.getCesTellerByOrgan=function (orgCode,tellContry){

			if(orgCode.length!=5){
				tellContry.options.length=0;
				tellContry.options.add(new Option("--请选择--",""));
				alert("输入的机构位数不正确，请重新输入");
			}
			
			if(orgCode.length == 5){
			  var url = g_pathPrefix+"smTeller.do?method=getSigleTellersByOrgCode&orgCode="+ orgCode;
			//  alert(url);
				var req = retrieveSynURL(url, "");
				try {
					if (req.status == 200) {
						var responseText = req.responseText;
						tellContry.options.length=0;
						tellContry.options.add(new Option("--请选择--",""));
						if(responseText == ""){
							alert("机构号为："+orgCode+"的机构下没有柜员！");
							return;
						}
						if(responseText == "error"){
							alert("机构号为："+orgCode+"的机构信息不合法！");
							return;
						}
						
						if(responseText == "error1"){
							alert("虚拟机构下没有柜员信息");
							return;
						}
						var cols = responseText.split("@@");
						for ( var i = 0; i < cols.length - 1; i++) {
							var k=cols[i].split('@');
							tellContry.options.add(new Option(k[0]+"-"+k[1],k[0]));
						}
					}
				} catch (e) {
					alert(" 出错！");
				}
			}
		}

 
//var interval 
//window.onfocus=function(){interval=window.setInterval("clipboardData.setData('text','')",100);} 
//window.onblur=function(){window.clearInterval(interval);} 
